package com.yubest.customserializer.anno;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author hweiyu
 * @Description
 * @Date 2022/9/7 10:36
 */
public interface TypeText<TYPE, TEXT> {

    TYPE getType();

    TEXT getText();

    default Map<TYPE, TEXT> getMap() {
        Map<TYPE, TEXT> map = new HashMap<>();
        for (TypeText<TYPE, TEXT> enumConstant : this.getClass().getEnumConstants()) {
            map.put(enumConstant.getType(), enumConstant.getText());
        }
        return map;
    }

}
